<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head lang="en">
<meta charset="UTF-8">
<title>评论</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<link rel="stylesheet" href="css/comment.css">
<link rel="stylesheet" href="css/star.css" />
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>

</head>

<body
	style="background: url(/images/beijing.jpg) no-repeat; background-size: 100% 100%;">

	<div class="header position-relative">
		<div class="wrap">
			<!--1.1.0 头部的左分区logo-->
			<div class="logo">
				<a href="default.jsp"><img src="img/logo.jpg" /></a>
			</div>
			<!--1.2.0头部的右分区-->
			<div class="header-right clearfix">
				<!--1.2.1右分区第一部分 登录条-->
				<div class="header-login">
					<ol class="list-inline" style="font-size: 15px;">
						<li>欢迎${USER.username}：</li>
						<%--若登录了--%>
						<c:if test="${!empty USER}">
							<li><a
								href="${pageContext.request.contextPath}/FindUserByUserName">个人中心</a></li>
							<li><a
								href="${pageContext.request.contextPath}/addCart.do?num=0">购物车</a></li>
							<li><a href="${pageContext.request.contextPath}/logout.do">退出</a></li>
						</c:if>
					</ol>
				</div>
				<!--1.2.3右分区第三部分 搜索框-->
				<div class="comment_top_sousuo" style="margin: 38px 0 0 46px;">
					<input type="text" class="comment_top_input" id="key"
						placeholder="请输入您要搜索的关键词">
					<button type="submit" class="comment_top_search"
						onclick="searchKey()">搜索</button>
				</div>

			</div>
		</div>

		<script type="text/javascript">
			function searchKey(){
				var key = document.getElementById("key").value;
				url = "${pageContext.request.contextPath}/FindAllProductByPname?key="+key;
				window.location.href=url;
			}
			document.onkeydown = function (e) { // 回车事件
				// 兼容FF和IE和Opera
			    var theEvent = window.event || e;
			    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
			    if (code == 13) {
			    	searchKey();
			    }
			}
		</script>
	</div>

	<div class="assess" style="margin: 120px auto;">
		<div class="assess_left" style="margin-top: 0;">
			<%--<img src="${Product.pimage}" style="width: 250px;">
			<ul>
				<li>${Product.pname}</li>
				<li style="color: red;">$${Product.shop_price}</li>
			</ul>--%>

		</div>


		<form method="post" action="/AddCommentBy" enctype="multipart/form-data"  style="margin-top: 0;">
			<ul>
				<li><input id="uid" name="uid" value="${USER.uid}"
					style="display: none;"></li>
				<%--<li><input id="pid" name="pid" value="${Product.pid}"
					style="display: none;"></li>--%>
				<li id="stars"><label for="">商品满意度</label>
					<div class="star_bg"
						style="background: url(/images/star.png) repeat-x;">
						<input type="radio" id="starScore1" name="score" class="score score_1" value="1" />
						<a href="#starScore1" class="star star_1"><label for="starScore1"></label></a>
						<input type="radio" id="starScore2" name="score" class="score score_2" value="2" />
						<a href="#starScore2" class="star star_2"><label for="starScore2"></label></a>
						<input type="radio" id="starScore3" name="score" class="score score_3" value="3" />
						<a href="#starScore3" class="star star_3"><label for="starScore3"></label></a>
						<input type="radio" id="starScore4" name="score" class="score score_4" value="4" />
						<a href="#starScore4" class="star star_4"><label for="starScore4"></label></a>
						<input type="radio" id="starScore5" name="score" class="score score_5" value="5" />
						<a href="#starScore5" class="star star_5"><label for="starScore5"></label></a>
					</div></li>
				<li id="advices"><label for="">评价晒单</label> <textarea
						name="cmcontent" id="cmcontent" cols="90" rows="10"
						placeholder="商品是否给力？快分享你的购买心得吧~"></textarea>
				<li><label for="">图片上传</label>
					<div id="images">
						<ul id="list"></ul>
						<input type="file" value="file" name="file" id="file"/>
					</div></li>
				<li id="btn">
					<input id="btn_submit" type="submit" value="提交"/>
					<button id="btn_reset" type="reset" onclick="resetComment()">重置</button>
				</li>
			</ul>
		</form>

		<script type="text/javascript">
			function resetComment(){
				if(window.confirm("是否要重置？")){
					document.getElementById('cmcontent').val = "";
					//清除图片
					var ulList = document.getElementById("list");
					ulList.innerHTML="";
					return true;
				}
			}
		</script>
	</div>
	<!-- 引入footer.jsp -->
	<jsp:include page="/footer.jsp" />
</body>
	<script>
		$("#btn_submit").click(function () {
			if ($("#file").val()==null||$("#file").val()==''){
				alert("必须上传图片哦!!!");
				return false;
			}
		})
	</script>
</html>